<?php
/**
 * Created by PhpStorm.
 * User: zoupeng
 * Date: 2018/9/16
 * Time: 上午9:58
 */

namespace app\admin\model;


use think\Exception;
use think\Model;

class Taoorder extends Model
{
    /**
     * 新增
     * @param $data
     * @return int|string
     */
    public static function add($data)
    {
        try{
            $id = self::insertGetId($data);
        }catch(Exception $exception){
            return 0;
        }
        return $id;
    }

    /**
     * 更新
     * @param $id
     * @param $data
     * @return Taoorder|int
     */
    public static function edit($id,$data)
    {
        try{
            self::where('id',$id)->update($data);
        }catch(Exception $exception){
            dump($exception->getMessage());die;
            return 0;
        }
        return $id;
    }
}